#!/usr/bin/perl 
use strict; 
use Encode; 
use LWP::Simple; 
use XML::RSS; 
use HTML::Parser;
#script to : downlaod and store HTML files from the irish independent RSS feed.

my @RSS_URLs = ("http://rss.independent.ie/c/32444/f/474631/index.rss"); 
 #binmode (STDOUT); 

binmode (STDOUT, ":encoding(utf8)"); 
 
for my $url (@RSS_URLs) { 
    my $document = LWP::Simple::get($url) or die "cannot get content from $url"; 
    my $rss = XML::RSS->new; 

	$rss->parse($document);
	#$i=1;

    for (@{$rss->{items}}) { 
  	my $results=$_->{guid};
  	my $title = $_->{title};
  	
	my $rss_htmls=(`wget $results`);
	#my $rss_htmls=(`wget -o \"".$title."\".html`.$results);
	
	#$rss_htmls = system("wget -o \"".$")
	print $rss_htmls;
	}
}

